//Reminder.java
package responsibilityChain.timer;

import java.util.Timer;
import java.util.TimerTask;

/**
 *@author:youtubezou
 *@version:2012-8-5
 */
public class Reminder
{
	private Timer timer;
	
	
	public static void main(String[] args)
	{
		System.out.println("Start count!");
		new Reminder(4);
		System.out.println("end of main");
	}
	
	
	public Reminder(int sec){
		timer = new Timer();
		timer.schedule(this.new ReminderTask(), sec*1000);
	}
	
	
	
	class ReminderTask extends TimerTask
	{
		@Override
		public void run()
		{
			System.out.println("Time is up!");
			timer.cancel();
		}
	}
}
